<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.dimeina.vo.*" %>
<%@ page import="com.dimeina.service.*" %>
<%@ page import="com.dimeina.service.impl.*" %>
<%@ page import="com.dimeina.servlet.*" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>发布商品</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link rel="stylesheet" href="${pageContext.request.contextPath}/ueditor/themes/default/css/ueditor.min.css" type="text/css"/>

<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/ueditor/ueditor.all.js"></script>

<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/ueditor/lang/zh-cn/zh-cn.js"></script>
<style type="text/css">
fieldset {
	border: 1px solid #1E82D1;
}

fieldset div {
    margin-bottom: 10px;
}

.btn {
	height: 30px;
	line-height: 30px;
	width: 80px;
	display: inline-block;
	background: #1E82D1;
	color: #fff;
	text-align: center;
	text-decoration: none;
	border-radius: 15px;
	border: none;
	cursor: pointer;
}

.red {
	font-size: 12px;
	color: #f00;
	font-weight: 700;
}
</style>
</head>

<body>
	<form id="topic-form" action="servlet/back/ServletBack?opr=addPro" method="post" enctype="multipart/form-data">
		<fieldset>
			<legend>商品基本信息</legend>
			<div>
				<label for="topCategoryID">1级分类：</label> 
				<select id="topCategoryID" name="topCategoryID">
					<option value="0">请选择</option>
					<%
						ProService proService = new ProServiceImpl();
						CategoryService categoryServiceImpl = new CategoryServiceImpl();
						List<Category> categoryList = categoryServiceImpl.findCategoryByPID(0);
						for(Category c : categoryList) {
					%> 
						<option value="<%= c.getId() %>"><%= c.getName() %></option>
					<% } %>
				</select>
				<select id="PCategoryID" name="PCategoryID">
					<option value="0">请选择</option>
					<%
						List<Category> categoryList2 = categoryServiceImpl.findCategoryByDepth(2);
						for(Category c : categoryList2) {
					%> 
						<option value="<%= c.getId() %>"><%= c.getName() %></option>
					<% } %>
				</select>
				<select id="selfCategoryID" name="selfCategoryID">
					<option value="0">请选择</option>
					<%
						List<Category> categoryList3 = categoryServiceImpl.findCategoryByDepth(3);
						for(Category c : categoryList3) {
					%> 
						<option value="<%= c.getId() %>"><%= c.getName() %></option>
					<% } %>
				</select>
				
			</div>


			<div>
				<label for="proName">商品名称：</label> <input type="text" name="proName"
					id="proName" />
			</div>

			<div>
				<label for="price">商品价格：</label> <input type="text" name="price"
					id="price" />
			</div>

            <div>
				<label for="capacity">规格(容量):</label> <input type="text" name="capacity"
					id="capacity" />
			</div>
			<div>
				<label for="description">商品描述：</label>
				<textarea rows="10" cols="100" name="description" id="description"></textarea>
			</div>
			<div>
				<label for="ingredient">商品成分：</label>
				<textarea rows="10" cols="100" name="ingredient" id="ingredient"></textarea>
			</div>
			<div>
				<label for="value">商品评价：</label> <input type="text" name="value"
					id="value" />
			</div>
			<div>
				<label for="inventory">商品库存：</label> <input type="text" name="inventory"
					id="inventory" />
			</div>
			
			<div>
				<label for="picpath">上传图片：</label> <input type="file" name="picpath" id="picpath" />
			</div>
			
			<div>
				<label for="content">详情介绍：</label>
				<textarea id="content" style="width:98%;height: 800px" name="content" id="content"></textarea>
			</div>
			<div>
				${ message }
			</div>
			<div>
				<input value="发布" type="submit" class="btn" />
			</div>
		</fieldset>
	</form>
	
	<script type="text/javascript">
		UE.getEditor('content');
	</script>
</body>
</html>
